import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lucide_icons/lucide_icons.dart';
import 'package:yuque/app_theme.dart';

class SearchPage extends StatefulWidget {
  const SearchPage({Key? key}) : super(key: key);

  @override
  State<SearchPage> createState() => _SearchPageState();
}

class _SearchPageState extends State<SearchPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
        padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
        child: Column(
          children: [
            _searchBar(),
          ],
        ),
      ),
    );
  }

  Widget _searchBar() {
    return Container(
      height: kToolbarHeight,
      padding: const EdgeInsets.symmetric(horizontal: 15.0, vertical: 11),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Expanded(
            child: Container(
              child: TextField(
                autofocus: true,
                textAlignVertical: TextAlignVertical.center,
                onSubmitted: (String _) {},
                style: AppTheme.textTheme.bodyText1,
                keyboardType: TextInputType.text,
                decoration: InputDecoration(
                  isCollapsed: true,
                  filled: true,
                  fillColor: Color(0xFFEBECF0),
                  enabledBorder: OutlineInputBorder(
                    borderSide: BorderSide(color: Color(0xFFEBECF0)),
                    borderRadius: BorderRadius.circular(4),
                  ),
                  focusedBorder: OutlineInputBorder(
                    borderSide: BorderSide(color: Color(0xFFEBECF0)),
                    borderRadius: BorderRadius.circular(4),
                  ),
                  prefixIcon: Icon(
                    LucideIcons.search,
                    color: Colors.grey,
                    size: 18,
                  ),
                  hintText: "搜索",
                  hintStyle: TextStyle(fontSize: 14, color: Colors.grey),
                ),
              ),
            ),
          ),
          SizedBox(width: 15),
          GestureDetector(onTap: () => Navigator.of(context).pop(), child: Text("取消", style: TextStyle(color: AppTheme.darkText))),
        ],
      ),
    );
  }
}
